package com.example.wac.config;

import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration;
import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author wuancheng
 * @description
 * @date 2022-01-05 10:53:00
 */

@Configuration
public class ZookeeperCenterConfig {

    @Bean(initMethod = "init")
    public ZookeeperRegistryCenter zookeeperRegistryCenter(@Value("${ZookeeperCenter.port}") String port, @Value("${ZookeeperCenter.name}") String name){
        ZookeeperConfiguration configuration = new ZookeeperConfiguration(port, name);
        return new ZookeeperRegistryCenter(configuration);
    }
}
